#ifndef CPCAPPACKET_H
#define CPCAPPACKET_H

#include <QObject>
#include <QQmlListProperty>

class CPCapPktData : public QObject
{
    Q_OBJECT
public:
    explicit CPCapPktData(QObject *parent = Q_NULLPTR);
    ~CPCapPktData();

    const QByteArray &data() const;
    Q_INVOKABLE void setData(const QString &data);

protected:
    QByteArray m_bytes;
};

class CPCapPacket : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QQmlListProperty<QObject> data READ data)
    Q_CLASSINFO("DefaultProperty", "data")
public:
    explicit CPCapPacket(QObject *parent = Q_NULLPTR);
    ~CPCapPacket();

    QQmlListProperty<QObject> data();

    virtual int headerLength();
    virtual int payloadLength();
    virtual bool buildHeader(QByteArray &data);
    virtual bool buildPacket(QByteArray &data);

protected:
    QList<QObject*> m_data;
};

#endif // CPCAPPACKET_H
